<?php
		include("dbconn.inc");
		include("dbfuc.inc");
		include("session.inc");		
		$user=$_SESSION["user"];
		$curid=$_SESSION["curid"];
		$dbconnection=$_SESSION["dbconnection"];		
	if(session_is_registered("dbconnection") )
	{
	
?>
<html>
<head>
<title></title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style17 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #000000;  }
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF; }
.style37 {color: #FF0000}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<?php
		if(($user!="") && (($curid!="") || ($curid!=0)))
		{
			$sql="";
?>		
<?php include "allheader.php"  ?>	
<?php	
		//echo $user;
			$sql="select N_POINT from POINT_MASTER where N_ID=$curid ";
			$result=mysql_query($sql);
			$rownum=mysql_num_rows($result);
			if($rownum >0)
			{
				$rownum=$rownum-1;
				$current_point=mysql_result($result,$rownum,"N_POINT");
			
			}		

		

?> 
<br>
<table width="724" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#666666">
  <tr bgcolor="#5AC5F9">
    <td height="25" colspan="6"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000" size="2"><strong>POINT TRANSFER DETAILS OF : <?php echo $user ?> </strong></font></td>
  </tr>
  <tr>
    <td width="28" height="18" bgcolor="#CCCCCC"><div align="center" class="style17">Slno</div></td>
    <td width="242" bgcolor="#CCCCCC"><div align="center" class="style17">TRANSACTION DETAILS</div></td>
    <td width="122" bgcolor="#CCCCCC"><div align="center" class="style17">VOUCHER NO </div></td>
    <td width="115" bgcolor="#CCCCCC"><div align="center" class="style17">DATE </div></td>
    <td width="112" bgcolor="#CCCCCC"><div align="center" class="style17">CREADIT </div></td>
    <td width="91" bgcolor="#CCCCCC"><div align="center" class="style17">DEBIT </div></td>
  </tr>
  <?php		
		$slno=0;$tot_credit=0;$tot_debit=0;
		$sql="select N_FROM_ID,N_TO_ID,C_TRAN_TYPE,N_VOUCHUR,N_AMOUT,N_DEDUCTION,D_DATE from transcation_details  where N_TO_ID=$curid ";
		$result=mysql_query($sql);
		$rownum=mysql_num_rows($result);
		while($rownum >0)
		{
			$slno=$slno+1;
			$rownum=$rownum-1;
			$fromid=mysql_result($result,$rownum,"N_FROM_ID");
			$toid=mysql_result($result,$rownum,"N_TO_ID");
			$date=mysql_result($result,$rownum,"D_DATE");
			$trans_type=mysql_result($result,$rownum,"C_TRAN_TYPE");
			$vouchure=mysql_result($result,$rownum,"N_VOUCHUR");
			$amount=mysql_result($result,$rownum,"N_AMOUT");	
			$deduction=mysql_result($result,$rownum,"N_DEDUCTION");		

			if($trans_type=="CREDIT"){
			 	$tran_details="Received From - ".$fromid;
				$credit_amount=$amount;
				$debit_amount=$deduction;
				$tot_credit=$tot_credit+$credit_amount;
			}
			else
			{		
				$tran_details="Transfered to  - ".$fromid;
				$debit_amount=$amount;
				$credit_amount=0;
				$tot_debit=$tot_debit+$debit_amount;
			}
?>
  <tr bgcolor="<%=bgcolour%>">
    <td class="style5"><div align="center"><?php echo $slno ?></div></td>
    <td class="style5"><div align="left"><?php echo $tran_details ?> </div></td>
    <td class="style5"><div align="center"><?php echo $vouchure ?></div></td>
    <td class="style5"><div align="center"><?php echo $date ?></div></td>
    <td class="style5"><div align="center"><?php echo $credit_amount ?> </div></td>
    <td class="style5"><div align="center"><?php echo $debit_amount ?> </div></td>
  </tr>
  <?php  
	}    
  if($slno==0)
  {
?>
  <tr>
    <td colspan="6" class="style5"><div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000" size="2"><strong>No Records Available</strong></font></div></td>
  </tr>
  <?php
  }
?>
</table>
<br>
<table width="531" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr>
    <td width="192"><span class="style37">Tottal Credit point </span></td>
    <td width="10"><span class="style37">:</span></td>
    <td width="319"><span class="style37"><?php echo $credit_amount ?></span></td>
  </tr>
  <tr>
    <td><span class="style37">Tottal Debit point </span></td>
    <td><span class="style37">:</span></td>
    <td><span class="style37"><?php echo $tot_debit ?></span></td>
  </tr>
  <tr>
    <td><span class="style37">Current balance point </span></td>
    <td><span class="style37">:</span></td>
    <td><span class="style37"><?php echo $current_point ?></span></td>
  </tr>
</table>
</body>
</html>
<?php
	}
	}
	else
	{
		$errormsg="Your session is expeired. Please login again.";
		header("location: index.php?error=$errormsg");
	}
?>	
